<template>
<el-row class="tac">
	<el-col>
	<el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#1F2D3D"
      text-color="#fff"
      :unique-opened="unique_opened"
      active-text-color="#ffd04b">  
		<div v-for="(secMenu, index) in menuData">
			<el-submenu :index=String(secMenu.id) v-bind:class="{ menutitle: true }">
			<template slot="title">
				<i class="el-icon-menu"></i>
          <span  style="margin-left: 5px; color: #D8D8D8">{{secMenu.title}}</span>
        </template>
          <el-menu-item-group>
            <div v-for="(item, subindex) in secMenu.child" :key="subindex">
              <el-menu-item  :index=String(item.id) @click="routerChange(item)" style="min-width: 0px;"  v-bind:class="{ menuactive: true }">
              	<span  style="margin-left: 7px;">
              		{{item.title}}
              	</span>
              </el-menu-item>
            </div>
        </el-menu-item-group>
			</el-submenu>
		</div>
	</el-menu>
	</el-col>
</el-row>
</template>
<style>
  .el-menu-item-group__title {
    padding: 0px;
  }
  .el-menu-item, .el-submenu__title {
    height: 50px;
    line-height: 50px;
    font-size: 15px;
  }
  .el-submenu .el-menu-item {
    height: 50px;
    line-height: 50px;
    font-size: 15px;
  }
  .menuactive {
  	color: #8aa4af;
    background-color: #2c3b41 !important;
  }
  .menutitle {
  	color: #c0ccda;
  	background-color: #324057 !important;
  }
</style>
<script>
export default {
  props: ['menuData', 'menu'],
  data() {
    return {
        unique_opened: true,
        showSortTitle: false
    }
  },
  methods: {
    routerChange(item) 	{
      // 与当前页面路由相等则刷新页面
      if (item.url != this.$route.path) {
        router.push(item.url)
      } else {
        _g.shallowRefresh(this.$route.name)
      }
    },
     handleOpen(key, keyPath) {
        // console.log(key, keyPath)
      },
      handleClose(key, keyPath) {
        // console.log(key, keyPath)
      }
    }
  }
</script> 